/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.unal.bioingenium.kbmed.knowledge.similarity.metrics;

import co.edu.unal.bioingenium.kbmed.knowledge.hierarchy.HierarchyService;

/**
 *
 * @author Alejandro Riveros Cruz
 */
public class PathLength implements SemanticSimilarity {

    private HierarchyService graphManager;

    /**
     * 
     */
    public PathLength() {
        this.graphManager = HierarchyService.getInstance();
    }

    /**
     * 
     * @param conceptId1
     * @param conceptId2
     * @param category
     * @return
     */
    @Override
    public float getSimilarity(String conceptId1, String conceptId2, String category) {
        return 1f / (float) ((graphManager.getArtificialShortestPath(conceptId1, conceptId2, category).size()) + 1);
    }
}
